﻿//Write a program that reads a number N and calculates the sum of the first N members of the sequence of Fibonacci: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, …
//Each member of the Fibonacci sequence (except the first two) is a sum of the previous two members.

using System;

class SumNFibonacciNumbers
{
    static void Main()
    {
        Console.Write("Enter N = ");
        uint n = uint.Parse(Console.ReadLine());

        uint firstNumber = 1;
        uint secondNumber = 0;
        uint thirdNumber = 0;
        uint sum = 0;
        for (int i = 0; i < n - 1; i++)
        {
            thirdNumber = firstNumber + secondNumber;
            firstNumber = secondNumber;
            secondNumber = thirdNumber;
            sum = sum + thirdNumber;
        }
        Console.WriteLine("Sum = {0}", sum);
    }
}
